<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>猫眼</title>
    <link rel="stylesheet" href="layui/css/layui.css">
</head>

<body class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo">猫眼后台管理系统</div>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item">
                    <a href="javascript:;" id="mobile"></a>
                </li>
                <!-- <li class="layui-nav-item"> -->
                    <!-- <a href="./login.html" id="header-loginout">登录</a> -->
                <!-- </li> -->
                <li class="layui-nav-item">
                    <a href="javascript:;" id="loginOut">退出登录</a>
                </li>
            </ul>
        </div>
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item">
                        <a href="./views/user/select.html" target="iframe">用户管理</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="./views/movie/select_movie.html" target="iframe">电影管理</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="./views/Cinema/select.html" target="iframe">院线管理</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="./views/article/Article.html" target="iframe">文章管理</a>
                    </li>
                </ul>
            </div>
        </div>

        <div class="layui-body">      
            <!-- 内容主体区域 -->
            <iframe src="" frameborder="0" name="iframe" style="width:100% ;height:100%;"></iframe>
        </div>
    </div>

    <script src="./js/lodash.min.js"></script>
    <script src="./js/mock-min.js"></script>
    <script src="./layui/layui.js"></script>
    <script src="./js/jquery-1.12.4.min.js"></script>
    <script src="./js/index.js"></script>
    <script src="./js/js.cookie.js"></script>
    <script>
        //JavaScript代码区域


        layui.use('element');



        // 登录用户控制
        const mobile = localStorage.getItem("mobile");
        if (mobile) {
            $("#mobile").text(mobile);
        } else {
            //登录失败，重新登录
            layui.use("layer", function () {
                layui.layer.msg("请先登录！", {
                    icon: 2,
                    time: 1000,
                    end: function () {
                        location.href = "./login.html"
                    }
                })
            })
        }

        // 注销
        $("#loginOut").click(function () {
            localStorage.removeItem("userName");

            //删除cookie
            Cookies.remove("userId");
            location.href = "./login.html";
        })
    </script>
</body>

</html>